#!/bin//bash

array=(1 2 3 4 5 6)
echo ${array[*]}
for i in ${array[*]}; do
    if [[ ${i} -gt 4 ]]; then
        array+=(2)
    fi
    echo ${i}
done
echo ${array[*]}